]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st/texture-cache: Ensure icons keep their aspect ratio when scaled down
authorSebastian Keller <skeller@gnome.org>
Wed, 10 Mar 2021 16:27:42 +0000 (17:27 +0100)
committerMarge Bot <marge-bot@gnome.org>
Sun, 14 Mar 2021 01:06:30 +0000 (01:06 +0000)
Window preview icons can get scaled down if the window they belong to is
very small and/or there are a lot of open windows. When scaled down this
way the icons would get scaled without keeping the aspect ratio. Fix
this by using a content gravity that keeps the aspect ratio.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3865

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1751>

src/st/st-texture-cache.c

index 0ed3df5e7605c92f53b208c940baed63e2e953fb..178acbb5dc08eb94f7edc4f65ad8299ac568b419 100644 (file)
@@ -983,6 +983,7 @@ st_texture_cache_load_gicon (StTextureCache    *cache,
   if (ST_IS_IMAGE_CONTENT (icon))
     {
       return g_object_new (CLUTTER_TYPE_ACTOR,
+                           "content-gravity", CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT,
                            "width", actor_size,
                            "height", actor_size,
                            "content", CLUTTER_CONTENT (icon),
@@ -1037,6 +1038,7 @@ st_texture_cache_load_gicon (StTextureCache    *cache,
   g_free (gicon_string);
 
   actor = create_invisible_actor ();
+  clutter_actor_set_content_gravity  (actor, CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT);
   clutter_actor_set_size (actor, actor_size, actor_size);
   if (!ensure_request (cache, key, policy, &request, actor))
     {